<?php
header("Content-Type: text/html;charset=utf-8");
include("../function/_nosql.php"); //
include("../function/function.php");
$kboy_userid = $_SESSION['kboy_userid'];
$kboy_user = $_SESSION['kboy_user'];
if(!$kboy_userid){
    echo 4;die;
}
$action = chkstr(trim($_REQUEST['action']));
$id = chkstr(trim($_REQUEST['id']));
if($action == 'youji'){
    if(getNewsNums("kboy_travel_youjigood","newsid=$id and uid=$kboy_userid") >0){//已经点过赞了
		echo 2;
		}else{
			$mysql = new sqlstr("kboy_forum_travel"); 
			$travel_best = getClassName("kboy_forum_travel","travel_best","id=$id");
			$travel_bests = $travel_best+1;
			$mysql -> set("travel_best",$travel_bests);
			$news_sql = $mysql -> updateSql("id=$id");
			$news_res = mysql_query($news_sql);
			mysql_query(" insert into `kboy_travel_youjigood`(`newsid`,`uid`) values( '".$id."' , '".$kboy_userid."' ) ");
			if($news_res){
			echo json_encode(array('id'=>1,'msg'=>$travel_bests));
			}
			else{
			echo 0;
			}
		}
}elseif($action == 'dianzan'){
    if(getNewsNums("kboy_travel_good","newsid=$id and uid=$kboy_userid") >0){//已经点过赞了
		echo 2;
		}
		else{
			$mysql = new sqlstr("kboy_forum_travel_message"); 
			$news_good = getClassName("kboy_forum_travel_message","news_good","id=$id");
			$news_goods = $news_good+1;
			$mysql -> set("news_good",$news_goods);
			$news_sql = $mysql -> updateSql("id=$id");
			$news_res = mysql_query($news_sql);
			mysql_query(" insert into `kboy_travel_good`(`newsid`,`uid`) values( '".$id."' , '".$kboy_userid."' ) ");
			if($news_res){
			echo json_encode(array('id'=>1,'msg'=>$news_goods));
			}
			else{
			echo 0;
			}
		}
}else{
    echo erro('服务器内部错误');
}













?>